<?php
require_once("Elements.php");

class PrivateMessageForm extends Zend_Form {
	
	private $send_user_id;
	
	public function PrivateMessageForm($send_user_id) {
		$this->send_user_id = $send_user_id;
		$this->__construct();
	}
	
	public function init() {
		$this->setMethod('post');
		
		$this->addElement('hidden', 'return', array(
        'value' => Zend_Controller_Front::getInstance()->getRequest()->getRequestUri(),                         
                ));
		$element = new Zend_Form_Element_Hidden('send_user_id');
		$element->setValue($this->send_user_id);
		$this->addElement($element);
		
		$element = new Zend_Form_Element_Hidden('type');
		$element->setValue(UserMessage::PRIVATE_MESSAGE);
		$this->addElement($element);
		
		$element = new Zend_Form_Element_Text('target_user_id');
		$element->setLabel('收件人:');
		$this->addElement($element);
		
		$elements = new Elements();
		$element = new Zend_Form_Element_Textarea('comment');
		$element->setLabel('消息:');
		$element->setValue('');
		$this->addElement($element);
		
		$submit = $this->createElement('submit', 'submit');
		$submit->setName('post');
		$submit->removeDecorator('DtDdWrapper');	//Remove unneccesary dt label	
		$this->addElement($submit);
	}
}
?>